let express = require('express')

let app = express()

app.all('/jsonp-server',function (request,response) {
    ;let data = {
        name: '小周'
        ,status: '帅'
    }

    let resultStr = JSON.stringify(data)

    //获取变量使用的是飘号，不是单引号
    response.end(`handle(${resultStr})`)
})

app.all('/check-username', function(request,response) {
    let result = false
    if (request.query.username === 'aaa'){
        result = true
    }
    response.end(`handle(${result})`)
})

app.all('/jQuery-jsonnp', function(request,response) {
    let callback = request.query.callback
    console.log(request.query)
    let result = {
        name: request.query.name,
        descp: '帅'
    }
    let resultStr = JSON.stringify(result)

    response.end(`${callback}(${resultStr})`)
})


app.listen('8000',function () {
    console.log('启动。。。')
})